const express = require('express');
const router = express.Router();

const layouts = 'client/layout/';

router.get('/', function (_req, res) {
    res.render(layouts + 'home_layout.html', {
        app:{
            title:'驾车点评',
            page:'../index.html',
            homePath:'#home_page',
            dataPage:'carlist'
        }
    });
});

router.get('/login', function (_req, res) {
    res.render(layouts + 'login_layout.html',{
        app:{
            title:'登录',
            page:'../login.html',
            dataPage:'signin'
        }
    });
});

router.get('/signup', function (_req, res) {
    res.render(layouts + 'login_layout.html',{
        app:{
            title:'注册',
            page:'../signup.html',
            dataPage:'signup'
        }
    });
});

router.get('/settings', function (_req, res) {
    res.render(layouts + 'page_layout.html',{
        app:{
            title:'设置',
            page:'../settings.html'
        }
    });
});

router.get('/comments', function (_req, res) {
    res.render(layouts + 'home_layout.html',{
        app:{
            title:'评价',
            page:'../comments.html',
            homePath:'#comments_page',
            dataPage:'commentlist'
        }
    });
});

router.get('/add', function (req, res) {
    res.render(layouts + 'page_layout.html',{
        app:{
            title:'点评',
            page:'../add.html',
            dataPage:'add',
            target:''
        }
    });
});

router.get('/add/:id', function (req, res) {
    res.render(layouts + 'page_layout.html',{
        app:{
            title:'点评',
            page:'../add.html',
            dataPage:'add',
            target:req.params.id
        }
    });
});

router.get('/cars/:id', function (req, res) {
    res.render(layouts + 'page_layout.html',{
        app:{
            title:req.params.id,
            page:'../cardetial.html',
            dataPage:'carDetial'
        }
    });
});

router.get('/notification', function (req, res) {
    res.render(layouts + 'page_layout.html',{
        app:{
            title:'提醒',
            page:'../notification.html',
            dataPage:'notification'
        }
    });
});

router.get('/members', function (req, res) {
    res.render(layouts + 'page_layout.html',{
        app:{
            title:'会员管理',
            page:'../members.html',
            dataPage:'members'
        }
    });
});

module.exports = router;